package com.csj.demo.service;


import com.csj.demo.dao.EmployeeDao;
import com.csj.demo.domain.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl {

    @Autowired
    EmployeeDao employeeDao;


    public List<Employee> SelectAll() {
        return employeeDao.SelectAll();
    }

//    public boolean add(Employee employee) {
//        if(employeeDao.add(employee)>0){
//            return  true;
//        }
//        return false;
//    }


    public boolean add(Employee employee) {
        if (employeeDao.insert(employee) > 0) {
            return true;
        }
        return false;
    }

    public boolean delete(int id) {
        if(employeeDao.deleteById(id)>0){
            return true;
        }
        return false;
    }

    public boolean update(Employee employee) {
        if(employeeDao.updateById(employee)>0){
            return true;
        }
        return false;
    }
}

